package com.szsh.aiot.hsm.domain.homeNetWork;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
import com.szsh.aiot.common.utils.StringUtils;

/**
 * 每一个拓扑节点包含的信息
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class NetTopInfo {

    private String downloadspeed;

    @SerializedName("par_mac")
    private String parMac;

    private String mac;

    @SerializedName("acc_type")
    private int accType;

    @SerializedName("acc_port")
    private String accPort;

    @SerializedName("dev_type")
    private String devType;

    @SerializedName("workmode")
    private String workmode;

    private String model;

    private String brand;

    private String os;

    private String ip;

    @SerializedName("last_inactive_time")
    private String lastInactiveTime;

    @SerializedName("last_active_time")
    private String lastActiveTime;

    @SerializedName("online_time")
    private int onlineTime;

    private String hostname;

    private long rxbytes;

    private long txbytes;

    @SerializedName("power_level")
    private int powerLevel;

    @SerializedName("acc_speed")
    private long accSpeed;

    private int active;

    private String devname;

    private String uploadspeed;

    @SerializedName("2Gchannel")
    private int twoGchannel;
    public String getParMac() {
        return parMac;
    }

    public void setParMac(String parMac) {
        this.parMac = parMac;
    }

    public String getMac() {
        return mac;
    }

    public void setMac(String mac) {
        this.mac = mac;
    }

    public int getAccType() {
        return accType;
    }

    public void setAccType(int accType) {
        this.accType = accType;
    }

    public String getAccPort() {
        return accPort;
    }

    public void setAccPort(String accPort) {
        this.accPort = accPort;
    }

    public String getDevType() {
        return devType;
    }

    public void setDevType(String devType) {
        this.devType = devType;
    }

    public String getWorkmode() {
        return workmode;
    }

    public void setWorkmode(String workmode) {
        this.workmode = workmode;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getOs() {
        return os;
    }

    public void setOs(String os) {
        this.os = os;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getLastInactiveTime() {
        return lastInactiveTime;
    }

    public void setLastInactiveTime(String lastInactiveTime) {
        this.lastInactiveTime = lastInactiveTime;
    }

    public String getLastActiveTime() {
        return lastActiveTime;
    }

    public void setLastActiveTime(String lastActiveTime) {
        this.lastActiveTime = lastActiveTime;
    }

    public int getOnlineTime() {
        return onlineTime;
    }

    public void setOnlineTime(int onlineTime) {
        this.onlineTime = onlineTime;
    }

    public String getHostname() {
        return hostname;
    }

    public void setHostname(String hostname) {
        this.hostname = hostname;
    }

    public long getRxbytes() {
        return rxbytes;
    }

    public void setRxbytes(long rxbytes) {
        this.rxbytes = rxbytes;
    }

    public long getTxbytes() {
        return txbytes;
    }

    public void setTxbytes(long txbytes) {
        this.txbytes = txbytes;
    }

    public int getPowerLevel() {
        return powerLevel;
    }

    public void setPowerLevel(int powerLevel) {
        this.powerLevel = powerLevel;
    }

    public long getAccSpeed() {
        return accSpeed;
    }

    public void setAccSpeed(long accSpeed) {
        this.accSpeed = accSpeed;
    }

    public int getActive() {
        return active;
    }

    public void setActive(int active) {
        this.active = active;
    }

    public String getDevname() {
        if (StringUtils.isBlank(devname)) {
            return StringUtils.isBlank(model) ? "智能设备" + getMac(mac) : model;
        } else {
            return devname;
        }
    }

    public void setDevname(String devname) {
        this.devname = devname;
    }

    public String getDownloadspeed() {
        return downloadspeed;
    }

    public void setDownloadspeed(String downloadspeed) {
        this.downloadspeed = downloadspeed;
    }

    public String getUploadspeed() {
        return uploadspeed;
    }

    public void setUploadspeed(String uploadspeed) {
        this.uploadspeed = uploadspeed;
    }

    public int getTwoGchannel() {
        return twoGchannel;
    }

    public void setTwoGchannel(int twoGchannel) {
        this.twoGchannel = twoGchannel;
    }

    /**
     * 取MAC后四位
     *
     * @param mac
     *            设备Mac
     * @return 截取设备Mac后四位
     */
    private String getMac(String mac) {
        if (StringUtils.isBlank(mac)) {
            return "";
        }
        if (mac.length() <= 4) {
            return mac;
        }
        return mac.substring(mac.length() - 4);
    }

}
